<template>
  <div>
      <van-field label="标题" v-model="form.title"/>
      <van-field label="内容" v-model="form.content"/> 
      <van-uploader :after-read='upload'/>
      <button @click="book">添加</button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            form:{'author_id':0,'pic':''}
        }
    },
      methods: {
        upload(file){
            this.form.pic = '/static/upload/1.jpg'
        },
        book(){
            let userid = localStorage.getItem('userid')
            if(userid){
                this.form.author_id = userid
            }
            this.axios.post('booksM',this.form).then(res=>{
                
            })
        }
    },
}
</script>

<style>

</style>